package com.example.mybatisplus.web.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.mybatisplus.mapper.UserMapper;
import com.example.mybatisplus.model.domain.User;
import com.example.mybatisplus.model.dto.PageDTO;
import com.example.mybatisplus.service.UserService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.example.mybatisplus.common.JsonResponse;
import com.example.mybatisplus.service.OrdersService;
import com.example.mybatisplus.model.domain.Orders;

import java.util.List;


/**
 *
 *  前端控制器
 *
 *
 * @author blue
 * @since 2022-01-07
 * @version v1.0
 */
@RestController
@RequestMapping("/api/orders")
public class OrdersController {

    private final Logger logger = LoggerFactory.getLogger( OrdersController.class );

    @Autowired
    private UserService userService;
    @Autowired
    private UserMapper userMapper;
    @Autowired
    private OrdersService ordersService;

    //获取数据，分页
    @GetMapping("/list")
    public JsonResponse list(PageDTO page, Orders orders) {
        Page<Orders> page1 = (Page<Orders>) ordersService.listByPage(page,orders);
        return JsonResponse.success(page1);
    }


}

